<%@page import="sdfi.lee.Newpj.DAO.AchievementDAO"%>
<%@page import="sdfi.lee.Newpj.Entity.Achievement"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="<a href='<c:url value='/achievement/achilist.jsp?pg=1'/>'>业绩成果</a>" name="location">
<link rel="stylesheet" href="../css/index.css" />
<link rel="stylesheet" href="../css/level.css" />
<script type="text/javascript" src="../js/jquery-1.6.js" ></script>
<script type="text/javascript" src="../js/index.js"></script>
<title>国家新药创制平台（山东）</title>
</head>
<%
	String pg=request.getParameter("pg");
	List<Achievement> list= new AchievementDAO().getAchivement_qu(Integer.valueOf(pg).intValue(),20);
	request.setAttribute("list",list);
	int intpg=Integer.valueOf(pg);
	Object obj=session.getAttribute("yejiechengguo");
	int count=0;
	if(obj==null){
		count=new AchievementDAO().getAchievementAccount();
		session.setAttribute("yejiechengguo",count);
	}else
	{
		count=((Integer)obj).intValue();
	}
%>
<body>

            	<c:forEach var="ache" items="${requestScope.list}">
            		<div class="newsitem">
            		<c:choose>
					<c:when test="${ache.type==0}">
						<c:url var="acheurl" value="/achievement/achidetail.jsp?id=${ache.id}&pg=${param.pg}"></c:url>
					</c:when>
					<c:otherwise>
					<c:url var="acheurl" value="/achievement/rachidetail.jsp?id=${ache.id}&path=${ache.path}&pg=${param.pg}"></c:url>
					</c:otherwise>
				</c:choose>
            			<div class="newstitle">
            			<c:if test="${fn:contains(ache.path,'acheivement')}">
            				[<font style="color:#f56">成果</font>]
            			</c:if>
            			<c:if test="${fn:contains(ache.path,'journal')}">
            				[<font style="color:#f00">期刊</font>]
            			</c:if>
            			<c:if test="${fn:contains(ache.path,'patent')}">
            				[<font style="color:#f25">专利</font>]
            			</c:if>
            			
            			<a href="${acheurl}" title="${ache.name}">${ache.name}</a>
            			</div>
            			<div class="newsdate">
            				&nbsp;${ache.dt}
            			</div>
            		</div>
            	 </c:forEach>
                <div id="pages">
                	<!-- 
                	每页<font>20</font>条,第<font>${param.pg}</font>页,该页
                	<font>${fn:length(requestScope.list) }</font>条
                    <c:choose>
                		<c:when test='${param.pg==null||param.pg==""||param.pg==1}'>
                			上页
                		</c:when>
                		<c:otherwise>
                			<c:url value='/achievement/achilist.jsp?pg=${param.pg-1}'  var="down"/>
                			 <a href="${down}">上页</a>
                		</c:otherwise>
                	</c:choose>
                	
                   	<c:choose>
                   		<c:when test="${fn:length(requestScope.list)<20}">
                   			下页
                   		</c:when>
                   		<c:otherwise>
                   			<a href="<c:url value='/achievement/achilist.jsp?pg=${param.pg+1}' />">下页</a>
                   		</c:otherwise>
                   	</c:choose>
                    -->
                      <a href="<c:url value='/achievement/achilist.jsp?pg=1' />">首页
                     </a>
                     		  <c:choose>
                		<c:when test='${param.pg==null||param.pg==""||param.pg==1}'>
                			<font>上页</font>
                		</c:when>
                		<c:otherwise>
                			<c:url value='/achievement/achilist.jsp?pg=${param.pg-1}'  var="down"/>
                			 <a href="${down}">上页</a>
                		</c:otherwise>
                	</c:choose>
                     	<%
                     		request.setAttribute("all",count/20+1);
                     
                     		for(int i=1;i<=(count/20)+1;i++)
                     		{
                     			request.setAttribute("i",i);
                     			if((intpg>=i&&intpg-i<5)||(i-intpg<=5&&intpg<i))
                     			{   
                     				if(intpg!=i)
                     				{
                     	%>
                     				
                		<a href="<c:url value='/achievement/achilist.jsp?pg=${requestScope.i}' />">
                			<%=i%>
                		</a>
                			<%
                     				}else
                     				{
                			%>
                				<font><%=i%></font>
                			<%
                     				}
                     			}else{
                			%>
                			<a href="<c:url value='/achievement/achilist.jsp?pg=${requestScope.i}'/>" style="display:none">
                			<%=i%>
                		</a>
                     		<%	
                     			}
                     		}
                     		%>
                     		<c:choose>
                   		<c:when test="${fn:length(requestScope.list)<20}">
                   			<font>下页</font>
                   		</c:when>
                   		<c:otherwise>
                   		<a href="<c:url value='/achievement/achilist.jsp?pg=${param.pg+1}' />">下页</a>
                   		</c:otherwise>
                   	</c:choose>
                   	 <a href="<c:url value='/achievement/achilist.jsp?pg=${requestScope.all}' />">最后一页
                     </a>
                    
                </div>
            
          
            	
    
</body>
</html>